package 软件工程实验三.A1.A12;

import java.util.ArrayList;
import java.util.List;

public class Client {
    public static void main(String[] args) {
        College college = new College("计算机与信息学院");

        // 创建学院、楼宇、课程
        Building building1 = new Building("信息技术楼1楼");
        Building building2 = new Building("信息技术楼2楼");
        Building building3 = new Building("信息技术楼3楼");

        Course computerNetwork = new Course("计算机网络");
        Course systemOperating = new Course("操作系统");
        Course computerArchitecture = new Course("计算机组成原理");
        Course dataStructure = new Course("数据结构");

        // 添加学院、楼宇、课程
        college.addBuilding(building1);
        college.addBuilding(building2);
        college.addBuilding(building3);
        college.addCourse(computerNetwork);
        college.addCourse(systemOperating);
        college.addCourse(computerArchitecture);
        college.addCourse(dataStructure);

        building2.addCourse(dataStructure);
        building1.addCourse(computerArchitecture);
        building3.addCourse(systemOperating);
        building3.addCourse(computerNetwork);

        List<Building> theBuilding = college.getTheBuilding();
        List<Course> theCourse = college.getTheCourse();

        System.out.println("学院名称：" + college.getName());
        for (Course course : theCourse) {
            System.out.println("学院开设的课程有：" + course.getName());
        }

        for (Building building : theBuilding) {
            System.out.println("楼名称：" + building.getName());
            List<Course> courses = building.getTheCourse();
            if (!courses.isEmpty()) {
                System.out.print("该楼开设的课程有：");
                for (Course course : courses) {
                    System.out.print(course.getName() + " ");
                }
                System.out.println();
            }
        }
    }
}
